package com.shiguiwu.springmybatis.app.function;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.mzt.logapi.service.IParseFunction;
import com.shiguiwu.springmybatis.app.entity.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @description: 自定义函数
 * @author: stone
 * @date: Created by 2022/12/10 17:01
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.app.function
 */
@Component
@Slf4j
public class OrderParseFunction implements IParseFunction {

    @Override
    public boolean executeBefore() {
        return true;
    }

    @Override
    public String functionName() {
        return "ORDER";

    }

    @Override
    public String apply(Object value) {
        //log.info("@@@@@@@@");
        if (ObjectUtil.isEmpty(value)) {
            return "";
        }
        log.info("###########,{}", value);
        Order order = new Order();
        order.setProductName("xxxx");
        return order.getProductName().concat("(").concat(value.toString()).concat(")");
    }
}
